/**
 *
 */
package com.honeybees.framework.spring.jdbc;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.CallableStatementCallback;
import org.springframework.jdbc.core.CallableStatementCreator;
import org.springframework.jdbc.core.ConnectionCallback;
import org.springframework.jdbc.core.ParameterizedPreparedStatementSetter;
import org.springframework.jdbc.core.PreparedStatementCallback;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.core.StatementCallback;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.jdbc.support.rowset.SqlRowSet;

/**
 * <dl>
 * <dt><b> 操作数据库 </b></dt>
 * <p>
 * <dd>功能描述</dd>
 * </dl>
 * <p>
 * Copyright (C) All rights reserved.
 * </p>
 *
 * @author 李远明
 * @since 2015-11-16 10:55:15
 */
public class DBManager extends JdbcDaoSupport implements IDBManager {

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T execute(ConnectionCallback<T> action) throws DataAccessException {
        return getJdbcTemplate().execute(action);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T execute(StatementCallback<T> action) throws DataAccessException {
        return getJdbcTemplate().execute(action);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public void execute(String sql) throws DataAccessException {
        getJdbcTemplate().execute(sql);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T query(String sql, ResultSetExtractor<T> rse) throws DataAccessException {
        return getJdbcTemplate().query(sql, rse);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public void query(String sql, RowCallbackHandler rch) throws DataAccessException {
        getJdbcTemplate().query(sql, rch);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> query(String sql, RowMapper<T> rowMapper) throws DataAccessException {
        return getJdbcTemplate().query(sql, rowMapper);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T queryForObject(String sql, RowMapper<T> rowMapper) throws DataAccessException {
        return getJdbcTemplate().queryForObject(sql, rowMapper);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T queryForObject(String sql, Class<T> requiredType) throws DataAccessException {
        return getJdbcTemplate().queryForObject(sql, requiredType);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public Map<String, Object> queryForMap(String sql) throws DataAccessException {
        return getJdbcTemplate().queryForMap(sql);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     * @deprecated
     */
    public long queryForLong(String sql) throws DataAccessException {
        throw new UnsupportedOperationException("请使用 queryForObject 方法代替");
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     * @deprecated
     */
    public int queryForInt(String sql) throws DataAccessException {
        throw new UnsupportedOperationException("请使用 queryForObject 方法代替");
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> queryForList(String sql, Class<T> elementType) throws DataAccessException {
        return getJdbcTemplate().queryForList(sql, elementType);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public List<Map<String, Object>> queryForList(String sql) throws DataAccessException {
        return getJdbcTemplate().queryForList(sql);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public SqlRowSet queryForRowSet(String sql) throws DataAccessException {
        return getJdbcTemplate().queryForRowSet(sql);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int update(String sql) throws DataAccessException {
        return getJdbcTemplate().update(sql);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int[] batchUpdate(String... sql) throws DataAccessException {
        return getJdbcTemplate().batchUpdate(sql);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T execute(PreparedStatementCreator psc, PreparedStatementCallback<T> action) throws DataAccessException {
        return getJdbcTemplate().execute(psc, action);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T execute(String sql, PreparedStatementCallback<T> action) throws DataAccessException {
        return getJdbcTemplate().execute(sql, action);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T query(PreparedStatementCreator psc, ResultSetExtractor<T> rse) throws DataAccessException {
        return getJdbcTemplate().query(psc, rse);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T query(String sql, PreparedStatementSetter pss, ResultSetExtractor<T> rse) throws DataAccessException {
        return getJdbcTemplate().query(sql, pss, rse);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T query(String sql, Object[] args, int[] argTypes, ResultSetExtractor<T> rse)
            throws DataAccessException {
        return getJdbcTemplate().query(sql, args, argTypes, rse);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T query(String sql, Object[] args, ResultSetExtractor<T> rse) throws DataAccessException {
        return getJdbcTemplate().query(sql, args, rse);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T query(String sql, ResultSetExtractor<T> rse, Object... args) throws DataAccessException {
        return getJdbcTemplate().query(sql, rse, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public void query(PreparedStatementCreator psc, RowCallbackHandler rch) throws DataAccessException {
        getJdbcTemplate().query(psc, rch);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public void query(String sql, PreparedStatementSetter pss, RowCallbackHandler rch) throws DataAccessException {
        getJdbcTemplate().query(sql, pss, rch);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public void query(String sql, Object[] args, int[] argTypes, RowCallbackHandler rch) throws DataAccessException {
        getJdbcTemplate().query(sql, args, argTypes, rch);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public void query(String sql, Object[] args, RowCallbackHandler rch) throws DataAccessException {
        getJdbcTemplate().query(sql, args, rch);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public void query(String sql, RowCallbackHandler rch, Object... args) throws DataAccessException {
        getJdbcTemplate().query(sql, rch, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> query(PreparedStatementCreator psc, RowMapper<T> rowMapper) throws DataAccessException {
        return getJdbcTemplate().query(psc, rowMapper);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> query(String sql, PreparedStatementSetter pss, RowMapper<T> rowMapper)
            throws DataAccessException {
        return getJdbcTemplate().query(sql, pss, rowMapper);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> query(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)
            throws DataAccessException {
        return getJdbcTemplate().query(sql, args, argTypes, rowMapper);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> query(String sql, Object[] args, RowMapper<T> rowMapper) throws DataAccessException {
        return getJdbcTemplate().query(sql, args, rowMapper);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> query(String sql, RowMapper<T> rowMapper, Object... args) throws DataAccessException {
        return getJdbcTemplate().query(sql, rowMapper, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)
            throws DataAccessException {
        return getJdbcTemplate().queryForObject(sql, args, argTypes, rowMapper);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T queryForObject(String sql, Object[] args, RowMapper<T> rowMapper) throws DataAccessException {
        return getJdbcTemplate().queryForObject(sql, args, rowMapper);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T queryForObject(String sql, RowMapper<T> rowMapper, Object... args) throws DataAccessException {
        return getJdbcTemplate().queryForObject(sql, rowMapper, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> requiredType)
            throws DataAccessException {
        return getJdbcTemplate().queryForObject(sql, args, argTypes, requiredType);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T queryForObject(String sql, Object[] args, Class<T> requiredType) throws DataAccessException {
        return getJdbcTemplate().queryForObject(sql, args, requiredType);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T queryForObject(String sql, Class<T> requiredType, Object... args) throws DataAccessException {
        return getJdbcTemplate().queryForObject(sql, requiredType, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public Map<String, Object> queryForMap(String sql, Object[] args, int[] argTypes) throws DataAccessException {
        return getJdbcTemplate().queryForMap(sql, args, argTypes);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public Map<String, Object> queryForMap(String sql, Object... args) throws DataAccessException {
        return getJdbcTemplate().queryForMap(sql, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     * @deprecated
     */
    public long queryForLong(String sql, Object[] args, int[] argTypes) throws DataAccessException {
        throw new UnsupportedOperationException("请使用 queryForObject 方法代替");
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     * @deprecated
     */
    public long queryForLong(String sql, Object... args) throws DataAccessException {
        throw new UnsupportedOperationException("请使用 queryForObject 方法代替");
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     * @deprecated
     */
    public int queryForInt(String sql, Object[] args, int[] argTypes) throws DataAccessException {
        throw new UnsupportedOperationException("请使用 queryForObject 方法代替");
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     * @deprecated
     */
    public int queryForInt(String sql, Object... args) throws DataAccessException {
        throw new UnsupportedOperationException("请使用 queryForObject 方法代替");
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elementType)
            throws DataAccessException {
        return getJdbcTemplate().queryForList(sql, args, argTypes, elementType);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> queryForList(String sql, Object[] args, Class<T> elementType) throws DataAccessException {
        return getJdbcTemplate().queryForList(sql, args, elementType);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> List<T> queryForList(String sql, Class<T> elementType, Object... args) throws DataAccessException {
        return getJdbcTemplate().queryForList(sql, elementType, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public List<Map<String, Object>> queryForList(String sql, Object[] args, int[] argTypes)
            throws DataAccessException {
        return getJdbcTemplate().queryForList(sql, args, argTypes);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public List<Map<String, Object>> queryForList(String sql, Object... args) throws DataAccessException {
        return getJdbcTemplate().queryForList(sql, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public SqlRowSet queryForRowSet(String sql, Object[] args, int[] argTypes) throws DataAccessException {
        return getJdbcTemplate().queryForRowSet(sql, args, argTypes);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public SqlRowSet queryForRowSet(String sql, Object... args) throws DataAccessException {
        return getJdbcTemplate().queryForRowSet(sql, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int update(PreparedStatementCreator psc) throws DataAccessException {
        return getJdbcTemplate().update(psc);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int update(PreparedStatementCreator psc, KeyHolder generatedKeyHolder) throws DataAccessException {
        return getJdbcTemplate().update(psc, generatedKeyHolder);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int update(String sql, PreparedStatementSetter pss) throws DataAccessException {
        return getJdbcTemplate().update(sql, pss);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int update(String sql, Object[] args, int[] argTypes) throws DataAccessException {
        return getJdbcTemplate().update(sql, args, argTypes);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int update(String sql, Object... args) throws DataAccessException {
        return getJdbcTemplate().update(sql, args);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int[] batchUpdate(String sql, BatchPreparedStatementSetter pss) throws DataAccessException {
        return getJdbcTemplate().batchUpdate(sql, pss);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int[] batchUpdate(String sql, List<Object[]> batchArgs) throws DataAccessException {
        return getJdbcTemplate().batchUpdate(sql, batchArgs);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public int[] batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes) throws DataAccessException {
        return getJdbcTemplate().batchUpdate(sql, batchArgs, argTypes);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> int[][] batchUpdate(String sql, Collection<T> batchArgs, int batchSize,
                                   ParameterizedPreparedStatementSetter<T> pss) throws DataAccessException {
        return getJdbcTemplate().batchUpdate(sql, batchArgs, batchSize, pss);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T execute(CallableStatementCreator csc, CallableStatementCallback<T> action) throws DataAccessException {
        return getJdbcTemplate().execute(csc, action);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public <T> T execute(String callString, CallableStatementCallback<T> action) throws DataAccessException {
        return getJdbcTemplate().execute(callString, action);
    }

    /**
     * {@inheritDoc}
     *
     * @version 2015-11-16 10:55:16
     */
    public Map<String, Object> call(CallableStatementCreator csc, List<SqlParameter> declaredParameters)
            throws DataAccessException {
        return getJdbcTemplate().call(csc, declaredParameters);
    }

}
